package V002_CollisionDetection;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Rectangle;
import java.awt.Toolkit;

/**
 *
 * @author Smai
 */
/**
 *
 * @author Smai
 *
 * positionInWorldX - tietää missä kohtaa taulukkoa tile sijaitsee
 * positionInWorldY
 *
 * width - Olion leveys
 * height - Olion korkeus
 *
 * collision - Onko olio este
 * texture - Olion texturi
 * image - kuva
 */
public class Player {

  private Toolkit toolkit = Toolkit.getDefaultToolkit();
  private int positionInWorldArrayX;
  private int positionInWorldArrayY;
  //private int focusPosX;
  //private int focusPosY;
  private int width;
  private int height;
  private String type;
  private String info;
  private boolean collision;
  private Image image;

  //X,Y,Width,Height,Type,Info,Collision
  public Player(int x, int y, int width, int height, String type, String info, boolean collision) {
    this.positionInWorldArrayX = x;
    this.positionInWorldArrayY = y;
    this.width = width;
    this.height = height;
    this.type = type;
    this.info = info;
    this.collision = collision;

    image = toolkit.getImage("Resources//" + type + ".png");
  }

  public void paint(Graphics gbi) {
    gbi.drawImage(image, positionInWorldArrayX * 32, positionInWorldArrayY * 32, null);
    gbi.setColor(Color.green);
    gbi.drawRect(positionInWorldArrayX * 32, positionInWorldArrayY * 32, width, height);
  }

  public Rectangle getRectangle(int x,int y) {
    return (new Rectangle(positionInWorldArrayX * 32+x, positionInWorldArrayY * 32+y, width, height));
  }

}
